<!--生产领料明细组件-->
<template>
    <div>
        <el-form :model="model" label-width="100px" class="demo-ruleForm">
            <el-row>
                <el-col :span="8">
                    <el-form-item label="领料编号" prop="Number">
                        <el-input v-model="model.Number" :readonly="true" ></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="8">
                    <el-form-item label="工单编号" prop="WorkorderCode" label-width="110px">
                        <el-input v-model="model.WorkorderCode" :readonly="true" ></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="8">
                    <el-form-item label="制单人" prop="Creator">
                        <el-input v-model="model.Creator" :readonly="true" ></el-input>
                    </el-form-item>
                </el-col>

            </el-row>

            <el-row>
                <el-col :span="8">
                    <el-form-item label="订单状态" prop="Status">
                        <el-select v-model="model.Status" :disabled="true" >
                            <el-option label="未审核" value="0"></el-option>
                            <el-option label="已审核" value="1"></el-option>
                            <el-option label="已退库" value="2"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>

                <el-col :span="8">
                    <el-form-item label="领料仓库" prop="WarehouseName">
                        <el-input :value="model.WarehouseName" :readonly="true">
                        </el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="8">
                    <el-form-item label="经办人" prop="EmployeesName">
                        <el-input :value="model.EmployeesName" :readonly="true" >
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>


            <el-row>
                <el-col :span="8">
                    <el-form-item label="领料日期" prop="PickDate">
                        <el-date-picker type="date" v-model="model.PickDate" :readonly="true" ></el-date-picker>
                    </el-form-item>
                </el-col>

                <el-col :span="8">
                    <el-form-item label="备注" prop="Remark">
                        <el-input v-model="model.Remark" :readonly="true"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>

        <div class="page-section">
            <!--表单-->
            <el-table :data="ItemData" ref="dataForm" v-loading="isLoading" height="360px">
                <el-table-column type="selection" width="55"></el-table-column>
                <el-table-column fixed prop="ItemCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="ItemName" label="物料名称" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="Model" label="型号" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="Spec" label="规格" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="Kind" label="品类" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="UnitOfMeasure" label="单位" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="CurrCount" label="库存数量" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="Count" label="数量" :show-overflow-tooltip="true">
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>
<script>
export default {
    components: {
    },
    props: {
        model: {
            require: true,
            type: Object
        }
    },
    data() {
        return {
            ItemData: [],
            isLoading: false,
        }
    },
    //组件创建时
    created() {
        this.GetOrderProductPickbyId(this.model.Id, this.model.WarehouseId)
    },
    methods: {
        //根据生产领料编号和仓库编号获取生产领料明细表方法
        GetOrderProductPickbyId(OrderProductPickId, WarehouseId) {
            this.isLoading = true
            this.$http.get('/api/OrderProductPick/GetOrderProductPickbyId', {
                params: {
                    OrderProductPickId: OrderProductPickId,
                    WareHouseId: WarehouseId
                }
            })
                .then((res) => {
                    console.log(res.Data)
                    this.ItemData = res.Data
                    this.isLoading = false
                })
        }
    }
}
</script>
